<html>
<head><meta charset="utf-8"><title>Require ABI for extern in 2021 lang-team#46 · t-lang/major changes · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/index.html">t-lang/major changes</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html">Require ABI for extern in 2021 lang-team#46</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="205924326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/205924326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> triagebot <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#205924326">(Aug 04 2020 at 15:50)</a>:</h4>
<p>A new proposal has been announced: <a href="https://github.com/rust-lang/lang-team/issues/46">#46</a>. It will be announced at the next meeting to try and draw attention to it, but usually MCPs are not discussed during triage meetings. If you think this would benefit from discussion amongst the team, consider proposing a design meeting.</p>



<a name="206370960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/206370960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#206370960">(Aug 09 2020 at 00:20)</a>:</h4>
<p>I'd liaison this one.</p>



<a name="207476002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207476002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207476002">(Aug 20 2020 at 00:05)</a>:</h4>
<p>I am not sure if this is the appropriate place for this comment, but I have previously suggested replacing <code>extern "&lt;ABI string"</code> with <code>abi "&lt;ABI string&gt;"</code>, because <code>extern</code> on its own does not actually give a function external linkage, nor does it demangle the function name (as it does in C++).</p>



<a name="207476087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207476087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207476087">(Aug 20 2020 at 00:06)</a>:</h4>
<p>I would like to propose, as an alternative to this proposal, deprecating <code>extern</code> in 2021 and replacing it with <code>abi</code>, then removing <code>extern</code> entirely in the edition after that.</p>



<a name="207480928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207480928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207480928">(Aug 20 2020 at 01:37)</a>:</h4>
<p>Where does the linkage go then?</p>
<p>Because the part about <code>extern</code> that I do strongly like is that you can link some code without a <code>build.rs</code> by just marking the block as linking to somewhere.</p>



<a name="207481002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207481002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207481002">(Aug 20 2020 at 01:38)</a>:</h4>
<p>though in the case of functions you export this might read a lot better:</p>
<div class="codehilite"><pre><span></span><code><span class="n">abi</span><span class="w"> </span><span class="s">&quot;C&quot;</span><span class="w"> </span><span class="k">fn</span> <span class="nf">four</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="mi">4_</span><span class="k">i32</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="207481298"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207481298" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207481298">(Aug 20 2020 at 01:46)</a>:</h4>
<p>If I remember correctly, <code>no_mangle</code> does that essentially as a side-effect. I'm not really thrilled with that behavior either, though.</p>



<a name="207481313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207481313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207481313">(Aug 20 2020 at 01:47)</a>:</h4>
<p>Arguably anything <code>pub</code> at the crate level should be externally linkable when compiled as a dynamic library.</p>



<a name="207481376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207481376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207481376">(Aug 20 2020 at 01:48)</a>:</h4>
<p>(without <code>abi</code> and <code>no_mangle</code>, it would use the Rust ABI, but of course that requires toolchain versions to match.)</p>



<a name="207482019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207482019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207482019">(Aug 20 2020 at 02:03)</a>:</h4>
<p><code>no_mangle</code> is such a weirdness that I don't think it should be automatically applied. It should be visually apparent within the code that something is up with this particular function. Particularly since a lot of <code>extern "C"</code> functions <em>don't</em> need to be <code>no_mangle</code> in the first place (eg, a callback function you're going to pass to an API at runtime).</p>



<a name="207482100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207482100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207482100">(Aug 20 2020 at 02:04)</a>:</h4>
<p>but either way, <code>no_mangle</code> absolutely doesn't create a linking from your crate to another library.</p>
<p>You do that with something like this</p>
<div class="codehilite"><pre><span></span><code><span class="cp">#[link(name = </span><span class="s">&quot;curses&quot;</span><span class="cp">)]</span><span class="w"> </span><span class="k">extern</span><span class="w"> </span><span class="s">&quot;C&quot;</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</code></pre></div>



<a name="207539376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207539376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207539376">(Aug 20 2020 at 15:57)</a>:</h4>
<p>I'm not saying <code>no_mangle</code> declarations link to external definitions; I'm saying that <code>no_mangle</code> on a definition sets the linkage attributes. <a href="https://internals.rust-lang.org/t/precise-semantics-of-no-mangle/4098">https://internals.rust-lang.org/t/precise-semantics-of-no-mangle/4098</a></p>



<a name="207539419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207539419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207539419">(Aug 20 2020 at 15:57)</a>:</h4>
<p>I also am definitely not suggesting that <code>no_mangle</code> should be automatically applied; <code>abi</code> and <code>no_mangle</code> would remain separate.</p>



<a name="207555831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207555831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207555831">(Aug 20 2020 at 18:16)</a>:</h4>
<p>I think we should have both <code>extern</code> and <code>abi</code>. <code>extern</code> should be used for <code>extern {}</code> blocks and <code>abi</code> should be used to specify the ABI of a function.</p>



<a name="207555879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207555879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207555879">(Aug 20 2020 at 18:16)</a>:</h4>
<p>So <code>extern</code> on a function definition (rather than a block of declarations) would be deprecated?</p>



<a name="207555912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207555912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207555912">(Aug 20 2020 at 18:17)</a>:</h4>
<p>And <code>abi</code> would be used in conjunction with <code>extern</code> for declaration blocks?</p>



<a name="207555943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207555943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207555943">(Aug 20 2020 at 18:17)</a>:</h4>
<p>Yes.</p>



<a name="207555945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207555945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207555945">(Aug 20 2020 at 18:17)</a>:</h4>
<p>I've always found it weird that <code>extern</code> has two very different meanings depending on how it's used.</p>



<a name="207555957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207555957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207555957">(Aug 20 2020 at 18:17)</a>:</h4>
<p>Agreed!</p>



<a name="207555970"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207555970" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207555970">(Aug 20 2020 at 18:17)</a>:</h4>
<p>It feels like C's <code>static</code> all over again.</p>



<a name="207556066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207556066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207556066">(Aug 20 2020 at 18:18)</a>:</h4>
<p>would <code>abi</code> automatically cause a function to have external linkage?</p>



<a name="207556096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207556096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207556096">(Aug 20 2020 at 18:18)</a>:</h4>
<p>No it just changes the ABI.</p>



<a name="207556130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207556130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207556130">(Aug 20 2020 at 18:18)</a>:</h4>
<p>Only <code>#[no_mangle]</code> gives you external linkage.</p>



<a name="207556131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207556131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207556131">(Aug 20 2020 at 18:18)</a>:</h4>
<p>How would external linkage be enabled? <code>pub</code>, <code>no_mangle</code>, or some combination?</p>



<a name="207556237"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207556237" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207556237">(Aug 20 2020 at 18:19)</a>:</h4>
<p>that still seems like a rather odd side-effect of <code>no_mangle</code>. Couldn't mangled function names still be linked dynamically if we wanted to enable that?</p>



<a name="207556454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207556454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207556454">(Aug 20 2020 at 18:21)</a>:</h4>
<p>Sure but that's done through Rust's normal privacy system. A mangled symbol will be exported only if the compiler determines it can be accessed from outside the crate. This includes private functions that are referred by inline functions, since crates that inline the latter will need to dynamically link to the former.</p>



<a name="207556530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207556530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207556530">(Aug 20 2020 at 18:22)</a>:</h4>
<p><code>#[no_mangle]</code> bypasses Rust's privacy system and assumes it is referenced directly from external code.</p>



<a name="207556570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207556570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207556570">(Aug 20 2020 at 18:23)</a>:</h4>
<p>Okay, so <code>pub</code> functions already are externally linkable?</p>



<a name="207556583"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207556583" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207556583">(Aug 20 2020 at 18:23)</a>:</h4>
<p>modulo bugs like <a href="https://github.com/rust-lang/rust/issues/50007">https://github.com/rust-lang/rust/issues/50007</a></p>



<a name="207556666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207556666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207556666">(Aug 20 2020 at 18:24)</a>:</h4>
<p><span class="user-mention silent" data-user-id="209168">Thom Chiovoloni</span> <a href="#narrow/stream/243200-t-lang.2Fmajor-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346/near/207556583">said</a>:</p>
<blockquote>
<p>modulo bugs like <a href="https://github.com/rust-lang/rust/issues/50007">https://github.com/rust-lang/rust/issues/50007</a></p>
</blockquote>
<p><span aria-label="grimacing" class="emoji emoji-1f62c" role="img" title="grimacing">:grimacing:</span></p>



<a name="207563441"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207563441" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207563441">(Aug 20 2020 at 19:22)</a>:</h4>
<p>Removing external linkage from non Rust-ABI symbols would reduce the mess slightly, but it would still be a mess.</p>



<a name="207563538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207563538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207563538">(Aug 20 2020 at 19:23)</a>:</h4>
<p>The linkage system needs a principled design, and that's certainly a larger challenge than changing the syntax from <code>extern "ABI"</code> to <code>abi "ABI"</code> (which I support).</p>



<a name="207563955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207563955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207563955">(Aug 20 2020 at 19:27)</a>:</h4>
<p>Right now it has a design that is typical for a compiler area without a careful maintainer - "the general rule works in the common case, a couple of other important cases are patched with hacks, step to the left or right and things break".</p>



<a name="207566408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207566408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207566408">(Aug 20 2020 at 19:49)</a>:</h4>
<p>Is there a use for <code>#[no_mangle]</code> <em>without</em> external linkage?</p>



<a name="207566571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207566571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207566571">(Aug 20 2020 at 19:50)</a>:</h4>
<p>And do you have any thoughts on what, if not <code>#[no_mangle]</code>, could be used to control external linkage? Perhaps a new <code>pub(...)</code> argument? (<code>pub(link)</code>?)</p>



<a name="207568215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207568215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207568215">(Aug 20 2020 at 20:04)</a>:</h4>
<p>I suppose you could use <code>#[no_mangle]</code> to intercept things that would otherwise link externally -- kind of like <code>LD_PRELOAD</code> hacks, but self-contained</p>



<a name="207568685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207568685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207568685">(Aug 20 2020 at 20:08)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120076">BatmanAoD (Kyle Strand)</span> <a href="#narrow/stream/243200-t-lang.2Fmajor-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346/near/207566571">said</a>:</p>
<blockquote>
<p>And do you have any thoughts on what, if not <code>#[no_mangle]</code>, could be used to control external linkage? Perhaps a new <code>pub(...)</code> argument? (<code>pub(link)</code>?)</p>
</blockquote>
<p><code>pub</code> doesn't seem like the same thing here. You could, theoretically, have a symbol that's private to a Rust module (so you can't import it via Rust), but made available under an unmangled name as an ELF symbol.</p>



<a name="207568738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207568738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207568738">(Aug 20 2020 at 20:09)</a>:</h4>
<p>I can think of good reasons to do that, such as the symbol being an implementation detail of a library crate and how it handles a library it's wrapping, but not something the library crate wants to expose as part of its public API.</p>



<a name="207568828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207568828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207568828">(Aug 20 2020 at 20:10)</a>:</h4>
<p>I think we need an orthogonal concept of symbol visibility (and a better name for that because Rust uses "visibility" to describe things like <code>pub</code> and <code>pub(crate)</code>).</p>



<a name="207568871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207568871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207568871">(Aug 20 2020 at 20:10)</a>:</h4>
<p><code>#[export]</code>? And perhaps <code>#[export(name="...")]</code> for aliases?</p>



<a name="207568928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207568928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207568928">(Aug 20 2020 at 20:11)</a>:</h4>
<p>(I also wonder if <code>#[export]</code> should <em>imply</em> <code>#[no_mangle]</code>. Is there any value in exporting a symbol whose name depends on Rust name mangling?)</p>



<a name="207570671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207570671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207570671">(Aug 20 2020 at 20:29)</a>:</h4>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span> I think so, e.g., you might want to have a Rust dylib that exports symbols and imports them from another Rust dylib, both using Rust name mangling</p>



<a name="207571885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207571885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207571885">(Aug 20 2020 at 20:40)</a>:</h4>
<p>is rust name mangling stable though? otherwise doing that sounds fraught with peril</p>



<a name="207572202"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207572202" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207572202">(Aug 20 2020 at 20:43)</a>:</h4>
<p><span class="user-mention silent" data-user-id="209168">Thom Chiovoloni</span> <a href="#narrow/stream/243200-t-lang.2Fmajor-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346/near/207571885">said</a>:</p>
<blockquote>
<p>is rust name mangling stable though? otherwise doing that sounds fraught with peril</p>
</blockquote>
<p>It's fraught with peril anyway, because the ABI needs to match as well.</p>



<a name="207572407"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207572407" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207572407">(Aug 20 2020 at 20:45)</a>:</h4>
<p><span class="user-mention silent" data-user-id="138448">cuviper</span> <a href="#narrow/stream/243200-t-lang.2Fmajor-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346/near/207568215">said</a>:</p>
<blockquote>
<p>I suppose you could use <code>#[no_mangle]</code> to intercept things that would otherwise link externally -- kind of like <code>LD_PRELOAD</code> hacks, but self-contained</p>
</blockquote>
<p>That's clever!</p>



<a name="207572540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207572540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207572540">(Aug 20 2020 at 20:46)</a>:</h4>
<p><span class="user-mention silent" data-user-id="239881">Josh Triplett</span> <a href="#narrow/stream/243200-t-lang.2Fmajor-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346/near/207568928">said</a>:</p>
<blockquote>
<p>(I also wonder if <code>#[export]</code> should <em>imply</em> <code>#[no_mangle]</code>. Is there any value in exporting a symbol whose name depends on Rust name mangling?)</p>
</blockquote>
<p>I'm not a fan of it being implicit, but perhaps <code>no_mangle</code> could be an alternative to <code>name="..."</code> in the <code>export</code> annotation: <code>#[export(no_mangle)]</code></p>



<a name="207572583"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207572583" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207572583">(Aug 20 2020 at 20:47)</a>:</h4>
<p>What about if <code>#[export]</code> uses the name mangling appropriate for the ABI of the symbol being exported? The <code>abi</code> keyword or argument to <code>#[export]</code> could also be added to <code>static</code> variables, since functions are only part of what can be linked.</p>



<a name="207572692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207572692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207572692">(Aug 20 2020 at 20:48)</a>:</h4>
<p>So this 2015/2018 definition:</p>
<div class="codehilite"><pre><span></span><code>#[no_mangle]
extern &quot;C&quot; fn ....
</code></pre></div>


<p>would become:</p>
<div class="codehilite"><pre><span></span><code>#[export(no_mangle)]
abi &quot;C&quot; fn ...
</code></pre></div>



<a name="207572804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207572804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207572804">(Aug 20 2020 at 20:49)</a>:</h4>
<p><span class="user-mention silent" data-user-id="229517">Jacob Lifshay</span> <a href="#narrow/stream/243200-t-lang.2Fmajor-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346/near/207572583">said</a>:</p>
<blockquote>
<p>What about if <code>#[export]</code> uses the name mangling appropriate for the ABI of the symbol being exported? The <code>abi</code> keyword or argument to <code>#[export]</code> could also be added to <code>static</code> variables, since functions are only part of what can be linked.</p>
</blockquote>
<p>Unfortunately, as far as I know there isn't much relation between ABI and name-mangling.</p>



<a name="207573132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207573132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207573132">(Aug 20 2020 at 20:52)</a>:</h4>
<p>Another way it could be done is:</p>
<div class="codehilite"><pre><span></span><code><span class="cp">#[export(mangle=</span><span class="s">&quot;C&quot;</span><span class="cp">)]</span><span class="w"></span>
<span class="n">abi</span><span class="w"> </span><span class="s">&quot;C&quot;</span><span class="w"> </span><span class="k">fn</span> <span class="o">..</span><span class="p">.</span><span class="w"></span>
<span class="cp">#[export(mangle=</span><span class="s">&quot;Win32Pascal&quot;</span><span class="cp">)]</span><span class="w"> </span><span class="c1">// IIRC this is slightly different than C on Win32</span>
<span class="n">abi</span><span class="w"> </span><span class="s">&quot;system&quot;</span><span class="w"> </span><span class="k">fn</span> <span class="o">..</span><span class="p">.</span><span class="w"></span>
<span class="cp">#[export(mangle=</span><span class="s">&quot;C&quot;</span><span class="cp">)]</span><span class="w"></span>
<span class="k">static</span><span class="w"> </span><span class="n">my_variable</span>: <span class="nc">UnsafeCell</span><span class="o">&lt;</span><span class="kt">i32</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">..</span><span class="p">.;</span><span class="w"></span>
</code></pre></div>



<a name="207573232"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207573232" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207573232">(Aug 20 2020 at 20:53)</a>:</h4>
<p><span class="user-mention silent" data-user-id="138448">cuviper</span> <a href="#narrow/stream/243200-t-lang.2Fmajor-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346/near/207568215">said</a>:</p>
<blockquote>
<p>I suppose you could use <code>#[no_mangle]</code> to intercept things that would otherwise link externally -- kind of like <code>LD_PRELOAD</code> hacks, but self-contained</p>
</blockquote>
<p>you cannot define same symbol twice within a crate in any way. monomorph collector will be angry at you trying to do so.</p>



<a name="207573254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207573254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207573254">(Aug 20 2020 at 20:53)</a>:</h4>
<p>We could potentially add <code>#[export(mangle="C++")]</code> as a future extension.</p>



<a name="207573356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207573356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207573356">(Aug 20 2020 at 20:54)</a>:</h4>
<p>This includes <code>declare</code> and then further attempt to to define the symbol.</p>



<a name="207573380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207573380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207573380">(Aug 20 2020 at 20:54)</a>:</h4>
<p>C doesn't mangle, and C++ varies from compiler to compiler (and almost certainly between different compiler versions).</p>



<a name="207573453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207573453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207573453">(Aug 20 2020 at 20:55)</a>:</h4>
<p>C mangles to some extent: several systems have <code>fn my_fn</code> produce the symbol <code>_my_fn</code></p>



<a name="207573522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207573522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207573522">(Aug 20 2020 at 20:56)</a>:</h4>
<p>_maybe_ we could support a <code>const</code> function to determine the actual name:</p>
<p><code>#[export(mangle=my_mangle_fn)]</code></p>



<a name="207573685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207573685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207573685">(Aug 20 2020 at 20:57)</a>:</h4>
<p>C++ on Linux has only a few commonly used C++ manglings (only 2 that I recall), and at least Clang and G++ are interoperable.</p>



<a name="207573852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207573852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207573852">(Aug 20 2020 at 20:59)</a>:</h4>
<p>Reference for one of the C++ mangling schemes: <a href="https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling">https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling</a></p>



<a name="207574051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207574051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207574051">(Aug 20 2020 at 21:01)</a>:</h4>
<p>So, we could use <code>#[export(mangle="C++-itanium")]</code></p>



<a name="207574297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207574297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207574297">(Aug 20 2020 at 21:03)</a>:</h4>
<p>Or, for windows: <code>#[export(mangle="C++-msvc")]</code> and maybe use a more specific string if MSVC's name mangling ever had a incompatible break.</p>



<a name="207574310"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207574310" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207574310">(Aug 20 2020 at 21:03)</a>:</h4>
<p>I'm less opposed to that than just <code>="C++"</code>.</p>



<a name="207574451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207574451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207574451">(Aug 20 2020 at 21:05)</a>:</h4>
<p>I'm not sure about it, though. It seems like any code wishing to be cross-platform would need to set its mangling scheme conditionally. I guess that's something of an argument for <code>"C++"</code> meaning "the typical mangling scheme for the target platform", but that seems much too "magic".</p>



<a name="207574565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207574565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207574565">(Aug 20 2020 at 21:06)</a>:</h4>
<p>In any case, I think we should leave non-Rust non-C name mangling schemes for later, just making sure that we have thought about how they could fit in in the future</p>



<a name="207574754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207574754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207574754">(Aug 20 2020 at 21:08)</a>:</h4>
<p>Actually, now that I think about it, the Rust compiler's target should contain all the information to determine the C++ name mangling scheme unambiguously, since Rust can and often does link to C++ code.</p>



<a name="207574990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207574990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207574990">(Aug 20 2020 at 21:10)</a>:</h4>
<p>So, <code>x86_64-pc-windows-msvc</code> would tell rustc that it needs to use the MSVC C++ mangling scheme and <code>x86_64-unknown-linux-gnu</code> tells it to use the Linux G++ mangling scheme (itanium)</p>



<a name="207575064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207575064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207575064">(Aug 20 2020 at 21:11)</a>:</h4>
<p>So <code>#[export(mangle="C++")]</code> should work just fine.</p>



<a name="207576208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207576208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207576208">(Aug 20 2020 at 21:22)</a>:</h4>
<p><span class="user-mention silent" data-user-id="229517">Jacob Lifshay</span> <a href="#narrow/stream/243200-t-lang.2Fmajor-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346/near/207574754">said</a>:</p>
<blockquote>
<p>...Rust can and often does link to C++ code.</p>
</blockquote>
<p>Is it really supported to link to C++ functions that aren't <code>extern "C"</code>?</p>



<a name="207577841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207577841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207577841">(Aug 20 2020 at 21:41)</a>:</h4>
<blockquote>
<p>I'm not sure about it, though. It seems like any code wishing to be cross-platform would need to set its mangling scheme conditionally.</p>
</blockquote>
<p>cfg_attr</p>



<a name="207586322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207586322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207586322">(Aug 20 2020 at 23:30)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120076">BatmanAoD (Kyle Strand)</span> <a href="#narrow/stream/243200-t-lang.2Fmajor-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346/near/207576208">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="229517">Jacob Lifshay</span> <a href="#narrow/stream/243200-t-lang.2Fmajor-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346/near/207574754">said</a>:</p>
<blockquote>
<p>...Rust can and often does link to C++ code.</p>
</blockquote>
<p>Is it really supported to link to C++ functions that aren't <code>extern "C"</code>?</p>
</blockquote>
<p>I should clarify, Rust programs often link to different C++ libraries that link to each other, like this:</p>
<div class="codehilite"><pre><span></span><code>Rust Lib &lt;-&gt; C++ Lib1 &lt;-&gt; C++ Lib2
  ^                         ^
  +-------------------------+
</code></pre></div>


<p>A good example of that is rustc linking to LLVMCore linking to LLVMCodeGen.</p>
<p>Even if Rust doesn't currently use C++ mangling, the C++ mangling scheme still needs to be well defined for each target for the two C++ libraries to link to each other.</p>



<a name="207586569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207586569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207586569">(Aug 20 2020 at 23:34)</a>:</h4>
<p>Do the entry-points for those libraries not use <code>extern "C"</code>?</p>



<a name="207593610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207593610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207593610">(Aug 21 2020 at 01:40)</a>:</h4>
<blockquote>
<p><code>pub(link)</code></p>
</blockquote>
<p>To be clear, this would require making <code>link</code> a keyword in this position</p>
<p><code>pub(restricted)</code> syntax _must_ start with a keyword so the parser can know in fixed lookahead what to parse</p>



<a name="207593646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207593646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207593646">(Aug 21 2020 at 01:41)</a>:</h4>
<p>Given e.g. <code>struct Foo ( pub ( &gt;|&lt;</code>, do you parse a visibility restriction or a type</p>



<a name="207593703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207593703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207593703">(Aug 21 2020 at 01:42)</a>:</h4>
<p>It could be <code>struct Foo ( pub ( link, Type ) )</code> with a field of tuple type <code>(link, Type)</code></p>



<a name="207593723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207593723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207593723">(Aug 21 2020 at 01:43)</a>:</h4>
<p>And since both paths and types can be arbitrarily long, visibility restrictions must start with a keyword so the parser can decide in fixed lookahead</p>



<a name="207593734"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207593734" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207593734">(Aug 21 2020 at 01:43)</a>:</h4>
<p>IIRC it's a max of two tokens (including the keyword) at this specific location.</p>



<a name="207652356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207652356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207652356">(Aug 21 2020 at 16:06)</a>:</h4>
<p>I don't see new contextual keywords for <code>pub</code> as too much of a problem, but I am convinced by Josh T's argument above that <code>pub</code> isn't appropriate for this</p>



<a name="207652375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207652375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207652375">(Aug 21 2020 at 16:06)</a>:</h4>
<p>(Though I am certainly open to counterarguments in favor of <code>pub</code>)</p>



<a name="207656685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207656685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207656685">(Aug 21 2020 at 16:46)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120076">BatmanAoD (Kyle Strand)</span> <a href="#narrow/stream/243200-t-lang.2Fmajor-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346/near/207586569">said</a>:</p>
<blockquote>
<p>Do the entry-points for those libraries not use <code>extern "C"</code>?</p>
</blockquote>
<p>No, basically all of LLVM uses C++ linkage between the different libraries. LLVM does provide an <code>extern "C"</code> API, but doesn't really use that API internally.</p>



<a name="207664886"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207664886" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207664886">(Aug 21 2020 at 18:03)</a>:</h4>
<p>Interesting. I assume that's only really expected to work when all these libraries are compiled and linked with the same toolchain?</p>
<p>In that case, I think there's definitely a valid use for specifying "toolchain-default mangling".</p>



<a name="207664939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207664939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207664939">(Aug 21 2020 at 18:04)</a>:</h4>
<p>(And ABI.)</p>



<a name="207688392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207688392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207688392">(Aug 21 2020 at 21:46)</a>:</h4>
<p>Well, (IIUC) in theory C++ doesn't have a stable ABI. In practice, the committee has been unwilling/unable to do things which change the ABI because so many people treat it as stable. I'd think people don't expect gcc and clang compiled c++ to link together, but users definitely expect to continue to use existing precompiled c++ <code>.o</code>s and dylibs when upgrading compilers in practice.</p>



<a name="207688529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207688529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207688529">(Aug 21 2020 at 21:48)</a>:</h4>
<p>Like, <code>std::unique_ptr</code> can't be passed in a register. People want to fix it, and nominally, they can, because nothing about ISO C++ promises a stable ABI for <code>std::unique_ptr</code>. But because of the ABI breakage, the comittee has resisted "fixing" that deficiency so far.</p>



<a name="207689338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207689338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207689338">(Aug 21 2020 at 21:58)</a>:</h4>
<p>g++ and clang++ absolutely do link together, at least on Linux (Itanium C++ ABI)</p>



<a name="207689346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207689346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207689346">(Aug 21 2020 at 21:58)</a>:</h4>
<p>otherwise clang++ couldn't use libstdc++ at all</p>



<a name="207689354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207689354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207689354">(Aug 21 2020 at 21:58)</a>:</h4>
<p>(which is the default on Linux)</p>



<a name="207695547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207695547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207695547">(Aug 21 2020 at 23:27)</a>:</h4>
<p>You're absolutely correct about C++ not having a stable ABI; the supported use-case for "toolchain-default mangling (and ABI)" would <em>only</em> be for linking binaries generated with the same version of the same toolchain. Of course, other combinations (versions without ABI-breaking changes, g++ with clang++) would often work, but it wouldn't be considered a bug when it doesn't work.</p>



<a name="207699673"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/207699673" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#207699673">(Aug 22 2020 at 00:50)</a>:</h4>
<p>When/If Rust adds support for C++ mangling/ABI (or maybe earlier if needed), we can split any targets we find that use multiple different incompatible C++ compilers. For example, if it turned out that G++ and the Intel C++ compiler weren't compatible on x86_64-unknown-linux-gnu, we could split out x86_64-unknown-linux-gnu-icc as a separate target to x86_64-unknown-linux-gnu (which would use G++).</p>



<a name="208382040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208382040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208382040">(Aug 28 2020 at 18:56)</a>:</h4>
<p>I find the motivation for changing the keyword a bit weak -- confusion alone doesn't seem like enough to me.</p>



<a name="208382098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208382098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208382098">(Aug 28 2020 at 18:56)</a>:</h4>
<p>But also woah there's a lot going on in this topic beyond the original proposal</p>



<a name="208433764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208433764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208433764">(Aug 29 2020 at 13:22)</a>:</h4>
<p>Sorry, yeah, the connection to the original proposal is tenuous at best. I brought up my idea here because I wanted to make its connection to the original proposal clear, but I probably should have opened a separate topic elsewhere and just linked to that.</p>



<a name="208433859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208433859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208433859">(Aug 29 2020 at 13:24)</a>:</h4>
<p>One other motivation for changing the keyword for function definitions is that, as Amanieu pointed out, we could leave <code>extern</code> for declaration blocks, which would make the terminology for discussing the two types of "extern functions" much clearer.</p>



<a name="208890294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208890294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208890294">(Sep 02 2020 at 21:28)</a>:</h4>
<p>I do agree that there is no good way to discuss <code>extern "C" fn foo() { }</code> as opposed to external linkage</p>



<a name="208890307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208890307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208890307">(Sep 02 2020 at 21:28)</a>:</h4>
<p>I am still not inclined to make changes here for the time being just because it doesn't seem worth it</p>



<a name="208891098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208891098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208891098">(Sep 02 2020 at 21:37)</a>:</h4>
<p>Side note: I'd also like to see a notion of ABI for function pointers.</p>



<a name="208891169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208891169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208891169">(Sep 02 2020 at 21:37)</a>:</h4>
<p>Including being generic over ABI.</p>



<a name="208891467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208891467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208891467">(Sep 02 2020 at 21:40)</a>:</h4>
<p>Function pointers can (and must) have ABI properly declared, though you cannot be generic over it. Niko has opened a MCP (first one even I think) about this but opted to close it eventually I think.</p>



<a name="208891492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208891492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208891492">(Sep 02 2020 at 21:40)</a>:</h4>
<p><span class="user-mention silent" data-user-id="239881">Josh Triplett</span> <a href="#narrow/stream/243200-t-lang.2Fmajor-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346/near/208891169">said</a>:</p>
<blockquote>
<p>Including being generic over ABI.</p>
</blockquote>
<p>+1, this entire function would be unnecessary if that were possible <a href="https://gitlab.com/YottaDB/Lang/YDBRust/-/blob/master/src/simple_api/mod.rs#L959-977">https://gitlab.com/YottaDB/Lang/YDBRust/-/blob/master/src/simple_api/mod.rs#L959-977</a></p>



<a name="208891544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208891544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208891544">(Sep 02 2020 at 21:41)</a>:</h4>
<p>On the topic of generics for <code>fn</code>, someone on discord yesterday was wishing they could have non-<code>'static</code> functions pointers, for when they're generating executable code at runtime (which they also deallocate later).</p>



<a name="208891737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208891737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208891737">(Sep 02 2020 at 21:43)</a>:</h4>
<p>I have been thinking off and on about proposing an edition-break that makes fn(...) not a function pointer type, instead requiring &amp;'static fn(...)</p>



<a name="208891902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208891902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208891902">(Sep 02 2020 at 21:44)</a>:</h4>
<p>Since we somewhat regularly hit confusion over function pointers being non-null in unsafe code for example. But I'm not sold on the idea given how wide spread the breakage would be.</p>



<a name="208892145"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208892145" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208892145">(Sep 02 2020 at 21:46)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> I'd like that as well.</p>



<a name="208892165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208892165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208892165">(Sep 02 2020 at 21:46)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> Here's another interesting usage...</p>



<a name="208892205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208892205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208892205">(Sep 02 2020 at 21:47)</a>:</h4>
<p>Inside the Linux kernel, you're allowed to use things like AVX or SSE, <em>only</em> if you first save off userspace state and restore it later; otherwise, you can't.</p>



<a name="208892261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208892261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208892261">(Sep 02 2020 at 21:47)</a>:</h4>
<p>It'd be interesting to have a safe function that retrieves a callable function pointer to a function using such instructions, with a lifetime of "until you clean up the state".</p>



<a name="208895279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208895279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208895279">(Sep 02 2020 at 22:16)</a>:</h4>
<p>Hmm, if those two ideas were combined then that function could return a guard that derefs to a <code>fn</code> <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>
<p>I guess one weirdness with <code>&amp;fn</code> is that it should be a thin pointer but it's still not <code>Sized</code>...</p>



<a name="208895592"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208895592" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208895592">(Sep 02 2020 at 22:19)</a>:</h4>
<p>Would <code>fn&lt;'a&gt;</code> for non-<code>static</code> function pointers be a breaking change?</p>



<a name="208896823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208896823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208896823">(Sep 02 2020 at 22:31)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> we have to make it sized, because otherwise it's backwards incompatible I think when passing to <code>fn foo&lt;T&gt;(v: T) {}</code> functions</p>



<a name="208904745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208904745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208904745">(Sep 03 2020 at 00:03)</a>:</h4>
<p>Well, <code>&amp;'static fn</code> would still be sized of course.  (Which is what I'd understood would be the replacement for what's currently typed as just <code>fn</code>.)</p>



<a name="208906099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208906099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BatmanAoD (Kyle Strand) <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208906099">(Sep 03 2020 at 00:19)</a>:</h4>
<p>Why would <code>&amp;'a fn</code> not be sized as well?</p>



<a name="208907266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208907266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208907266">(Sep 03 2020 at 00:38)</a>:</h4>
<p>Ah, right, yes.</p>



<a name="208989874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/243200-t-lang/major%20changes/topic/Require%20ABI%20for%20extern%20in%202021%20lang-team%2346/near/208989874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/243200-t-lang/major-changes/topic/Require.20ABI.20for.20extern.20in.202021.20lang-team.2346.html#208989874">(Sep 03 2020 at 16:00)</a>:</h4>
<p>having <code>fn</code> pointers with generic ABI and lifetimes sounds awesome, I'm writing a JIT compiler (for the <a href="https://salsa.debian.org/Kazan-team/kazan">Kazan Vulkan driver</a>) where scoping the <code>fn</code> pointers to the lifetime of the allocated memory would make it much nicer.</p>
<p>If <code>fn</code> were to need to be a pointer/reference to <code>Sized</code>, the pointee could be a zero-sized type of some sort.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>